<script type="text/javascript">
// <![CDATA[

	// display the popup
	function show_popup(UserID)
	{
		close_popup()
		sendRequest(UserID)
		document.getElementById('popup').style.display='block';
	}

	// hide the popup
	function close_popup()
	{
		document.getElementById('popup').style.display='none';
		document.getElementById('ajax_username').innerHTML = '';
		document.getElementById('ajax_registert').innerHTML = '';
		document.getElementById('ajax_posts').innerHTML = '';
		document.getElementById('ajax_from').innerHTML = '';
		document.getElementById('ajax_last_visit').innerHTML = '';
		document.getElementById('ajax_avatar').innerHTML = '<img src="{T_THEME_PATH}/images/loading.gif" alt="" />';
		document.getElementById('ajax_rank').innerHTML = '';
		document.getElementById('ajax_website').innerHTML = '';
	}

	// Make the request	
	function createRequestObject() {
		var ro;
		var browser = navigator.appName;
		if(browser == "Microsoft Internet Explorer"){
			ro = new ActiveXObject("Microsoft.XMLHTTP");
		} else {
			ro = new XMLHttpRequest();
		}
		return ro;
	}
	
	var http_getuser = createRequestObject();
	
	function sendRequest(UserID)
	{
		http_getuser.open('get', '{ROOT_PATH}includes/ajax_userinfo.php?userid='+UserID);
		http_getuser.onreadystatechange = handleResponse;
		http_getuser.send(null);
	}

	// fill in the response
	function handleResponse() {
		if(http_getuser.readyState == 4){
			var xmlDoc	= http_getuser.responseXML;
			document.getElementById('ajax_username').innerHTML = xmlDoc.getElementsByTagName('username')[0].firstChild.nodeValue;
			document.getElementById('ajax_registert').innerHTML = xmlDoc.getElementsByTagName('regdate')[0].firstChild.nodeValue;
			document.getElementById('ajax_posts').innerHTML = xmlDoc.getElementsByTagName('posts')[0].firstChild.nodeValue;
			document.getElementById('ajax_website').innerHTML = xmlDoc.getElementsByTagName('website')[0].firstChild.nodeValue;
			document.getElementById('ajax_from').innerHTML = xmlDoc.getElementsByTagName('from')[0].firstChild.nodeValue;
			document.getElementById('ajax_last_visit').innerHTML = xmlDoc.getElementsByTagName('lastvisit')[0].firstChild.nodeValue;
			document.getElementById('ajax_rank').innerHTML = xmlDoc.getElementsByTagName('rank')[0].firstChild.nodeValue;
			document.getElementById('ajax_avatar').innerHTML = xmlDoc.getElementsByTagName('avatar')[0].firstChild.nodeValue;
		}
	}
	
	// set popup to mouse possition
	document.onmousemove = set_div_to_mouse;
	function set_div_to_mouse(e)
	{
		var docX, docY;
		if(e)
		{
			if(typeof(e.pageX) == 'number') { docX = e.pageX; docY = e.pageY;}
			else {docX = e.clientX; docY = e.clientY;}
		}
		else 
		{
			e = window.event;
			docX = e.clientX; docY = e.clientY;
			if(document.documentElement && (document.documentElement.scrollTop || document.documentElement.scrollLeft)) 
			{
				docX += document.documentElement.scrollLeft; docY += document.documentElement.scrollTop;
			}
			else if(document.body && (document.body.scrollTop || document.body.scrollLeft)) 
			{
				docX += document.body.scrollLeft; docY += document.body.scrollTop;
			}
		}
		if (docX > document.body.offsetWidth - 400) 
		{
			document.getElementById('popup').style.left = (docX - 390) + "px";
		} 
		else 
		{
			document.getElementById('popup').style.left = (docX - 10) + "px";
		}
		document.getElementById('popup').style.top    = (docY + 20) + "px";
	}
// ]]>
</script>
<div class="forabg" id="popup" style="display: none;">
   <div class="inner">
      <span class="corners-top"><span></span></span>
      <ul class="topiclist fullwidth">
         <li class="header"><dl><dt>{L_USERS} {L_INFORMATION}</dt></dl></li>
      </ul>
      <ul class="topiclist forums">
         <li><dl>
            <dd style="width:100%">
               <div id="ajax_avatar"></div>
               <strong>{L_USERNAME}:</strong> <span id="ajax_username"></span><br />
               <strong>{L_TOTAL_POSTS}:</strong> <span id="ajax_posts"></span><br />
               <strong>{L_SORT_RANK}:</strong> <span id="ajax_rank"></span><br />
               <strong>{L_JOINED}:</strong> <span id="ajax_registert"></span><br />
               <strong>{L_LAST_VISIT}:</strong> <span id="ajax_last_visit"></span><br />
               <strong>{L_LOCATION}:</strong> <span id="ajax_from"></span><br />
               <strong>{L_WEBSITE}:</strong> <span id="ajax_website"></span>
               <br style="clear: both;">
            </dd>
         </dl></li>
      </ul>
      <span class="corners-bottom"><span></span></span>
   </div>
</div>